package org.example.aggres;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * aggres 算子
 */
public class DataAggrees {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<Dog> source = env.fromElements(
                new Dog("aa", "k", 1),
                new Dog("bb", "b", 5),
                new Dog("cc", "b", 6),
                new Dog("dd", "u", 8),
                new Dog("ee", "u", 4),
                new Dog("ff", "b", 4));
        source.keyBy(Dog::getAddr)
//                .sum("age")
//                .max("age")
//                .min("age")
                .print();
        env.execute();
    }
}